package kr.hkit.androidcomplete02.fragment;

import kr.hkit.androidcomplete02.R;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.widget.Toast;

public class MyAlterDialogPragment extends DialogFragment {

	public Dialog onCreateDialog(Bundle savedInstanceState) {
		Bundle bundle = getArguments();
		String title = bundle.getString("title");
		String msg = bundle.getString("message");
		return new AlertDialog.Builder(getActivity())
				.setIcon(R.drawable.ic_launcher)
				.setTitle(title)
				.setMessage(msg)
				.setPositiveButton("확인", new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int whichButton) {
						doPositiveClick();
					}
				})
				.setNegativeButton("취소", new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int whichButton) {
						doNegativeClick();
					}
				}).create();
	}

	public void doPositiveClick() {
		Toast.makeText(getActivity(), "Positive click!", Toast.LENGTH_LONG)
				.show();
	}

	public void doNegativeClick() {
		Toast.makeText(getActivity(), "Negative click!", Toast.LENGTH_LONG)
				.show();
	}

}
